<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  exclude-result-prefixes="msxsl"
  version="1.0">
<xsl:import href="../Common/meta.xsl"/>
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
<xsl:param name="lang" select="'chi'" />
<xsl:param name="code" select="'code'" />
<xsl:param name="items" select="'item'" />
<xsl:param name="audience" select="'audience'" />
<xsl:variable name="headers" select="document(/guides/headers/@href)//header[@lang=$lang]" />

<xsl:template name="title">
	<xsl:value-of select="$headers/title" />
</xsl:template>

<xsl:template match="guides">
  <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
      <xsl:call-template name="content-lang" />
      <title>
        <xsl:call-template name="title" />
      </title>
      <link rel="stylesheet" type="text/css" media="screen" href="/eform/css/guide2009.css" />
      <script type="text/javascript" src="/eform/js/passData.js"></script>
    </head>
    <body>
      <xsl:variable name="def_title_1">
        <xsl:value-of select="title/column[@name=$code]/description[@lang=$lang]" />
      </xsl:variable>
      <xsl:variable name="def_title_2a">
        <xsl:value-of select="title/column[@name=$items]/category[@name='postal']/description[@lang=$lang]" />
      </xsl:variable>
      <xsl:variable name="def_title_2b">
        <xsl:value-of select="title/column[@name=$items]/category[@name='telecom']/description[@lang=$lang]" />
      </xsl:variable>
      <xsl:variable name="def_title_2c">
        <xsl:value-of select="title/column[@name=$items]/category[@name='special']/description[@lang=$lang]" />
      </xsl:variable>
      <xsl:variable name="def_title_2d">
        <xsl:value-of select="title/column[@name=$items]/category[@name='tourist']/description[@lang=$lang]" />
      </xsl:variable>
      <xsl:variable name="def_title_3">
        <xsl:value-of select="title/column[@name=$audience]/description[@lang=$lang]" />
      </xsl:variable>

      <xsl:variable name="submit_txt">
        <xsl:if test="$lang='chi'">
          <xsl:value-of select="'遞交確認'" />
        </xsl:if>
        <xsl:if test="$lang='chis'">
          <xsl:value-of select="'递交确认'" />
        </xsl:if>
        <xsl:if test="$lang='eng'">
          <xsl:value-of select="'Submit'" />
        </xsl:if>
        <xsl:if test="$lang='por'">
          <xsl:value-of select="'Entregar'" />
        </xsl:if>
      </xsl:variable>

      <xsl:variable name="clear_txt">
        <xsl:if test="$lang='chi'">
          <xsl:value-of select="'清除所有選擇'" />
        </xsl:if>
        <xsl:if test="$lang='chis'">
          <xsl:value-of select="'清除所有选择'" />
        </xsl:if>
        <xsl:if test="$lang='eng'">
          <xsl:value-of select="'Clear'" />
        </xsl:if>
        <xsl:if test="$lang='por'">
          <xsl:value-of select="'Repor'" />
        </xsl:if>
      </xsl:variable>

      <form name="guideform" mothod="post" action="VisitForm.asp" onSubmit="windows.close()">

        <xsl:for-each select="content">
          <table border="0">
            <tr>
              <th class="column1">
                <xsl:value-of select="$def_title_1" />
              </th>
              <xsl:if test="@name='postal'">
                <th class="column2">
                  <xsl:value-of select="$def_title_2a" />
                </th>
              </xsl:if>
              <xsl:if test="@name='telecom'">
                <th class="column2">
                  <xsl:value-of select="$def_title_2b" />
                </th>
              </xsl:if>
              <xsl:if test="@name='special'">
                <th class="column2">
                  <xsl:value-of select="$def_title_2c" />
                </th>
              </xsl:if>
              <xsl:if test="@name='tourist'">
                <th class="column2">
                  <xsl:value-of select="$def_title_2d" />
                </th>
              </xsl:if>
              <th class="column3">
                <xsl:value-of select="$def_title_3" />
              </th>
            </tr>
            <xsl:for-each select="category">
              <xsl:for-each select="title">
                <tr>
                  <td class="category_title" colspan="3">
                    <xsl:value-of select="description[@lang=$lang]" />
                  </td>
                </tr>
              </xsl:for-each>
              <xsl:for-each select="group">
                <xsl:for-each select="title">
                  <tr>
                    <td class="group_title" colspan="3">
                      <xsl:value-of select="description[@lang=$lang]" />
                    </td>
                  </tr>
                </xsl:for-each>
                <xsl:for-each select="item">
                  <tr>
                    <td>
                      <label>
                        <xsl:element name="input">
                          <xsl:attribute name="type">checkbox</xsl:attribute>
                          <xsl:attribute name="class">chk</xsl:attribute>
                          <xsl:attribute name="name">chkbox</xsl:attribute>
                          <xsl:attribute name="value">
                            <xsl:choose>
                              <xsl:when test="@code=''">
                                <xsl:value-of select="link/description[@lang=$lang]"/>
                              </xsl:when>
                              <xsl:otherwise>
                                <xsl:value-of select="@code" />
                              </xsl:otherwise>
                            </xsl:choose>
                          </xsl:attribute>
                        </xsl:element>
                        <xsl:value-of select="@code" />
                      </label>
                    </td>
                    <td>
                      <xsl:copy-of select="link/description[@lang=$lang]/*" />
                    </td>
                    <td>
                      <xsl:value-of select="audience/description[@lang=$lang]" />
                    </td>
                  </tr>
                </xsl:for-each>
              </xsl:for-each>
            </xsl:for-each>
          </table>
        </xsl:for-each>

        <center>
          <xsl:element name="input">
            <xsl:attribute name="type">button</xsl:attribute>
            <xsl:attribute name="value">
              <xsl:value-of select="$submit_txt" />
            </xsl:attribute>
            <xsl:attribute name="onClick">return PopupClose();return false</xsl:attribute>
          </xsl:element>
          <xsl:element name="input">
            <xsl:attribute name="type">reset</xsl:attribute>
            <xsl:attribute name="value">
              <xsl:value-of select="$clear_txt" />
            </xsl:attribute>
          </xsl:element>
        </center>

      </form>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>